package cn.xiaohaoo.datacleaning;


import cn.xiaohaoo.medicine.util.mongo.MongoDatabaseUtils;
import org.bson.Document;

/**
 * 清理空白数据
 */
public class DataClear {
    public static void main(String[] args) {
        MongoDatabaseUtils.queryAllDocuments(MongoDatabaseUtils.MEDICINE_DETAIL_COLLECTION).forEach(v -> {
            Object name = v.get("name");
            if (name == null) {
                MongoDatabaseUtils.deleteDocument(
                    MongoDatabaseUtils.MEDICINE_DETAIL_COLLECTION, new Document().append("_id", v.get("_id")));
            }
        });
    }

}
